<html>
<#include "../common/header.ftl" />
<#include "../common/IprHead.ftl" />
<script>
$(function(){
	
	$('#submit').on('click', function() {
		if (($("#type").val().trim()) == '') {
			tip('请填写名称！！！');
			return;
		}
		let obj = $("#type").val();
		console.log(JSON.parse(JSON.stringify(obj)))
		$.ajax({
			url : "index?method=addType",
			type : "POST",
			data : {type:obj},
			success : function(res) {
				let data = JSON.parse(res)
				if (data.code === 0) {
					tip("添加"+data.msg)
					setTimeout("location.reload()",500)
				}
				else{
					tip(data.msg)
				}
			},
			error : function(res) {
				console.log("res", res);
			}
		});
		/* console.log('data', $('form').serializeArray()) */
	})
})
function tip (msg){
		$("#warn").text(msg)
		$("#modal-282051").click()
	}
</script>
</head>
 
<body >
<div id="tq_kefu_main" class="tq_div_main" style="border: 0px ridge rgb(234, 234, 234); visibility: visible; position: fixed; top: 500px; z-index: 9997; padding: 0px; background: transparent none repeat scroll 0% 0%; text-align: center; right: 10px; width: auto;"><div id="tq_kefu_normal_container"><img src="static/IPR_news/kefu2.gif" style="BACKGROUND:transparent none repeat scroll 0% 0%;cursor:pointer" onclick="TQKF.kefuimg.Distrabute()" border="0"></div></div>
	<#include "../common/IprHeader.ftl"/>

    <!-- 主要内容 -->
    <div class="ad-show">
    
	<div class="container" style="width:90%;max-width:1600px;">
		<div class="row clearfix">
			<div class="col-md-12 column">
		

			<#include "../modal/addType.ftl"/>
			<#include "../modal/tips.ftl"/>

 <a id="modal-282051" href="#modal-warns" style="display:none" role="button" class="" data-toggle="modal"></a>
		
				<div class="list-group ">
					<hr/>
					<#if lists ??>
						<#if types ??>
					<a style="text-decoration:none;color:#fff" class="btn btn-danger" type="button" href="index">
				 返回：
					</a>
					<button class="btn btn-warning" type="button">
				 分类：
					</button>
				
					<#list types as item> <a href="index?method=list&type=${typesid[item_index]}"><button
							class="btn btn-info" type="button">${item }</button></a> </#list>
					</#if>
					
					<#if Session.user ?? &&
					Session.user.role == 1>
					<a id="modal-282051" href="#modal-addType"  role="button"  data-toggle="modal" class="btn btn-warning" type="button">
						<em class="glyphicon glyphicon-plus"></em>  
					</a>
					</#if>
					
					<br>
					<br>
					<#if (lists.data?size>0)>
					<#else>
					<div class="list-group-item  list-group-item-warning">
						<p><h1><b>没有查到数据哦!</b></h1></p>
					</div>
					
					</#if>
					<#list lists.data as item> 
					
					<#if Session.user ?? &&
					Session.user.role == 0> <#if item.newsState == 1> <a
						href="index?method=detail_page&id=${item.newsId }"
						class="list-group-item list-group-item-success ">
						<h4 class="list-group-item-heading">
							<div <#if item.newsClick gt 100>
								style="color:red"						
							</#if>
							>${item.newsName }
							_By【${item.newsAuthor }】 
							<#if item.newsClick gt 100 && item.newsClick lte 400>
							<span class="glyphicon glyphicon-fire" />
							</#if>
							<#if item.newsClick gt 401 && item.newsClick lte 800>
							<span class="glyphicon glyphicon-fire" />
							<span class="glyphicon glyphicon-fire" />
							</#if>
							<#if item.newsClick gt 801>
							<span class="glyphicon glyphicon-fire" />
							<span class="glyphicon glyphicon-fire" />
							<span class="glyphicon glyphicon-fire" />
							</#if>
							</div>
							
							 <#if item.uId == Session.user.id>
									 <span style="float:right">【我的文章】</span>
								</#if>
							</h4>
						<p style="display:block;padding:5px"><span style="font-size:25px" class="glyphicon glyphicon-eye-open"/><span class="badge" style="font-size:15px">${item.newsClick }</span><span style="font-size:25px" class="glyphicon glyphicon-eye-open"/></p>
						<p>
							<#if item.newsType ?? && item.newsType?size gt 0 > <#list
							item.newsType as _item> <span class="label label-info"
								style="margin-right: 0px; margin-left: 5px">${ _item}</span>
							</#list> <#else> <span class="label label-info"
								style="margin-right: 0px; margin-left: 5px">其他</span> </#if>
						</p> <span class="label label-primary">${item.publisher } </span> <span
						class="label label-primary">${item.createtime?string("yyyy-MM-dd HH:mm:ss zzzz")}</span>
					</a> </#if> <#elseif item.state !=1> 
					
					
					<a
						href="index?method=detail_page&id=${item.id }"
						class="list-group-item 
						<#if item.state == 0>	list-group-item-success</#if>
						<#if item.state == 1> list-group-item-danger</#if>
						"
						>
						<h4 class="list-group-item-heading">
						
						<div>
							${item.title }
							_By【Admin】 
							</div>
						</h4>
						创建时间：<span class="label label-primary">${item.createtime } </span>
						 修改时间：<span class="label label-primary">${item.updatetime } </span>
							
					</a> </#if>
					
					 </#list>
					<#else>
					<div class="list-group-item  list-group-item-warning">
						<p><h1><b>没有查到数据哦!</b></h1></p>
					</div>
					</#if>
					
				</div>
			</div>
			<div class="col-md-12 column">
				<ul class="pagination pull-right">
					<#if lists.pageNo lte 1>
					<li class="disabled"><a href="#">上一页</a></li> <#else >
					<li><a
					<#if type ?? && type == "news_click" >
						href="index?method=sort&page=${lists.pageNo - 1}&size=${lists.pageSize}&key=news_click"
					<#elseif type ?? && type == "news_id" >
						href="index?method=sort&page=${lists.pageNo - 1}&size=${lists.pageSize}&key=news_id"
					<#elseif newsType ?? >
						href="index?method=list&page=${lists.pageNo - 1}&size=${lists.pageSize}&type=${newsType }"
					<#else>
						href="index?method=list&page=${lists.pageNo - 1}&size=${lists.pageSize}"
					</#if>						
						>上一页</a>
					</li> </#if> <#list 1..lists.totalPage as index> <#if lists.pageNo ==
					index>
					<li class="disabled"><a href="#">${index}</a></li> <#else>
					<li><a
						<#if type ?? && type == "news_click" >
						href="index?method=sort&page=${index}&size=${lists.pageSize}&key=news_click"
					<#elseif type ?? && type == "news_id" >
						href="index?method=sort&page=${index}&size=${lists.pageSize}&key=news_id"
					<#elseif newsType ?? >
						href="index?method=list&page=${index}&size=${lists.pageSize}&type=${newsType }"
					<#else>
						href="index?method=list&page=${index}&size=${lists.pageSize}"	
					</#if>
						>${index}</a>
					</li> </#if> </#list> <#if lists.pageNo gte lists.totalPage>
					<li class="disabled"><a href="#">下一页</a></li> <#else >
					<li><a
					<#if type ?? && type == "news_click" >
						href="index?method=sort&page=${lists.pageNo + 1}&size=${lists.pageSize}&key=news_click"
					<#elseif type ?? && type == "news_id" >
						href="index?method=sort&page=${lists.pageNo + 1}&size=${lists.pageSize}&key=news_id"
					<#elseif newsType ?? >
						href="index?method=list&page=${lists.pageNo + 1}&size=${lists.pageSize}&type=${newsType }"
					<#else>
						href="index?method=list&page=${lists.pageNo + 1}&size=${lists.pageSize}"	
					</#if>
						>下一页</a>
					</li> </#if>
				</ul>
			</div>

		</div>
	
	
	</div>
      <div class="mt40">
    <!-- 主要内容 end-->
    	<#include "../common/IprFooter.ftl"/>
		<script src="static/js/3.1.0bootstrap.min.js"></script>
</body>
</html>